package shop.yaojianfeng.springlearning.section9.service.impl;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

/**
 * 自定义 用户认证逻辑
 * @author yaojianfeng
 */
public class UserDetailsServiceImpl implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String name) throws UsernameNotFoundException {
        //写个伪代码 仿照从数据库中查询
        return User.withUsername(name).password("$2a$10$ra0QM4Mwl.DCc90dNPRYZeIwA5rYfJtHUYGpWKwrMZdRHqjPJonGC").authorities("/thymeleaf/*,/sys/r1,/sys/r2").build();
    }
}
